using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Adex
{
	/// <summary>
	/// Strongly-typed collection for the TblHistoricalDataForNewCommercial class.
	/// </summary>
    [Serializable]
	public partial class TblHistoricalDataForNewCommercialCollection : ActiveList<TblHistoricalDataForNewCommercial, TblHistoricalDataForNewCommercialCollection>
	{	   
		public TblHistoricalDataForNewCommercialCollection() {}
        
        /// <summary>
		/// Filters an existing collection based on the set criteria. This is an in-memory filter
		/// Thanks to developingchris for this!
        /// </summary>
        /// <returns>TblHistoricalDataForNewCommercialCollection</returns>
		public TblHistoricalDataForNewCommercialCollection Filter()
        {
            for (int i = this.Count - 1; i > -1; i--)
            {
                TblHistoricalDataForNewCommercial o = this[i];
                foreach (SubSonic.Where w in this.wheres)
                {
                    bool remove = false;
                    System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName);
                    if (pi.CanRead)
                    {
                        object val = pi.GetValue(o, null);
                        switch (w.Comparison)
                        {
                            case SubSonic.Comparison.Equals:
                                if (!val.Equals(w.ParameterValue))
                                {
                                    remove = true;
                                }
                                break;
                        }
                    }
                    if (remove)
                    {
                        this.Remove(o);
                        break;
                    }
                }
            }
            return this;
        }
		
		
	}
	/// <summary>
	/// This is an ActiveRecord class which wraps the tblHistoricalDataForNewCommercial table.
	/// </summary>
	[Serializable]
	public partial class TblHistoricalDataForNewCommercial : ActiveRecord<TblHistoricalDataForNewCommercial>, IActiveRecord
	{
		#region .ctors and Default Settings
		
		public TblHistoricalDataForNewCommercial()
		{
		  SetSQLProps();
		  InitSetDefaults();
		  MarkNew();
		}
		
		private void InitSetDefaults() { SetDefaults(); }
		
		public TblHistoricalDataForNewCommercial(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}
        
		public TblHistoricalDataForNewCommercial(object keyID)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByKey(keyID);
		}
		 
		public TblHistoricalDataForNewCommercial(string columnName, object columnValue)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByParam(columnName,columnValue);
		}
		
		protected static void SetSQLProps() { GetTableSchema(); }
		
		#endregion
		
		#region Schema and Query Accessor	
		public static Query CreateQuery() { return new Query(Schema); }
		public static TableSchema.Table Schema
		{
			get
			{
				if (BaseSchema == null)
					SetSQLProps();
				return BaseSchema;
			}
		}
		
		private static void GetTableSchema() 
		{
			if(!IsSchemaInitialized)
			{
				//Schema declaration
				TableSchema.Table schema = new TableSchema.Table("tblHistoricalDataForNewCommercial", TableType.Table, DataService.GetInstance("Adex"));
				schema.Columns = new TableSchema.TableColumnCollection();
				schema.SchemaName = @"dbo";
				//columns
				
				TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
				colvarId.ColumnName = "ID";
				colvarId.DataType = DbType.Int32;
				colvarId.MaxLength = 0;
				colvarId.AutoIncrement = true;
				colvarId.IsNullable = false;
				colvarId.IsPrimaryKey = true;
				colvarId.IsForeignKey = false;
				colvarId.IsReadOnly = false;
				colvarId.DefaultSetting = @"";
				colvarId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarId);
				
				TableSchema.TableColumn colvarUserID = new TableSchema.TableColumn(schema);
				colvarUserID.ColumnName = "UserID";
				colvarUserID.DataType = DbType.Int32;
				colvarUserID.MaxLength = 0;
				colvarUserID.AutoIncrement = false;
				colvarUserID.IsNullable = false;
				colvarUserID.IsPrimaryKey = false;
				colvarUserID.IsForeignKey = false;
				colvarUserID.IsReadOnly = false;
				colvarUserID.DefaultSetting = @"";
				colvarUserID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarUserID);
				
				TableSchema.TableColumn colvarCompanyCode = new TableSchema.TableColumn(schema);
				colvarCompanyCode.ColumnName = "CompanyCode";
				colvarCompanyCode.DataType = DbType.Int32;
				colvarCompanyCode.MaxLength = 0;
				colvarCompanyCode.AutoIncrement = false;
				colvarCompanyCode.IsNullable = true;
				colvarCompanyCode.IsPrimaryKey = false;
				colvarCompanyCode.IsForeignKey = false;
				colvarCompanyCode.IsReadOnly = false;
				colvarCompanyCode.DefaultSetting = @"";
				colvarCompanyCode.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCompanyCode);
				
				TableSchema.TableColumn colvarUserName = new TableSchema.TableColumn(schema);
				colvarUserName.ColumnName = "UserName";
				colvarUserName.DataType = DbType.String;
				colvarUserName.MaxLength = 350;
				colvarUserName.AutoIncrement = false;
				colvarUserName.IsNullable = false;
				colvarUserName.IsPrimaryKey = false;
				colvarUserName.IsForeignKey = false;
				colvarUserName.IsReadOnly = false;
				colvarUserName.DefaultSetting = @"";
				colvarUserName.ForeignKeyTableName = "";
				schema.Columns.Add(colvarUserName);
				
				TableSchema.TableColumn colvarProduct = new TableSchema.TableColumn(schema);
				colvarProduct.ColumnName = "Product";
				colvarProduct.DataType = DbType.String;
				colvarProduct.MaxLength = 550;
				colvarProduct.AutoIncrement = false;
				colvarProduct.IsNullable = false;
				colvarProduct.IsPrimaryKey = false;
				colvarProduct.IsForeignKey = false;
				colvarProduct.IsReadOnly = false;
				colvarProduct.DefaultSetting = @"";
				colvarProduct.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProduct);
				
				TableSchema.TableColumn colvarVersion = new TableSchema.TableColumn(schema);
				colvarVersion.ColumnName = "Version";
				colvarVersion.DataType = DbType.String;
				colvarVersion.MaxLength = 550;
				colvarVersion.AutoIncrement = false;
				colvarVersion.IsNullable = false;
				colvarVersion.IsPrimaryKey = false;
				colvarVersion.IsForeignKey = false;
				colvarVersion.IsReadOnly = false;
				colvarVersion.DefaultSetting = @"";
				colvarVersion.ForeignKeyTableName = "";
				schema.Columns.Add(colvarVersion);
				
				TableSchema.TableColumn colvarLaunchDay = new TableSchema.TableColumn(schema);
				colvarLaunchDay.ColumnName = "LaunchDay";
				colvarLaunchDay.DataType = DbType.String;
				colvarLaunchDay.MaxLength = 550;
				colvarLaunchDay.AutoIncrement = false;
				colvarLaunchDay.IsNullable = false;
				colvarLaunchDay.IsPrimaryKey = false;
				colvarLaunchDay.IsForeignKey = false;
				colvarLaunchDay.IsReadOnly = false;
				colvarLaunchDay.DefaultSetting = @"";
				colvarLaunchDay.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLaunchDay);
				
				TableSchema.TableColumn colvarDuration = new TableSchema.TableColumn(schema);
				colvarDuration.ColumnName = "Duration";
				colvarDuration.DataType = DbType.String;
				colvarDuration.MaxLength = 10;
				colvarDuration.AutoIncrement = false;
				colvarDuration.IsNullable = true;
				colvarDuration.IsPrimaryKey = false;
				colvarDuration.IsForeignKey = false;
				colvarDuration.IsReadOnly = false;
				colvarDuration.DefaultSetting = @"";
				colvarDuration.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDuration);
				
				TableSchema.TableColumn colvarSector = new TableSchema.TableColumn(schema);
				colvarSector.ColumnName = "Sector";
				colvarSector.DataType = DbType.String;
				colvarSector.MaxLength = 550;
				colvarSector.AutoIncrement = false;
				colvarSector.IsNullable = true;
				colvarSector.IsPrimaryKey = false;
				colvarSector.IsForeignKey = false;
				colvarSector.IsReadOnly = false;
				colvarSector.DefaultSetting = @"";
				colvarSector.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSector);
				
				TableSchema.TableColumn colvarSubSector = new TableSchema.TableColumn(schema);
				colvarSubSector.ColumnName = "SubSector";
				colvarSubSector.DataType = DbType.String;
				colvarSubSector.MaxLength = 550;
				colvarSubSector.AutoIncrement = false;
				colvarSubSector.IsNullable = true;
				colvarSubSector.IsPrimaryKey = false;
				colvarSubSector.IsForeignKey = false;
				colvarSubSector.IsReadOnly = false;
				colvarSubSector.DefaultSetting = @"";
				colvarSubSector.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSubSector);
				
				TableSchema.TableColumn colvarCategory = new TableSchema.TableColumn(schema);
				colvarCategory.ColumnName = "Category";
				colvarCategory.DataType = DbType.String;
				colvarCategory.MaxLength = 550;
				colvarCategory.AutoIncrement = false;
				colvarCategory.IsNullable = true;
				colvarCategory.IsPrimaryKey = false;
				colvarCategory.IsForeignKey = false;
				colvarCategory.IsReadOnly = false;
				colvarCategory.DefaultSetting = @"";
				colvarCategory.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCategory);
				
				TableSchema.TableColumn colvarAdvertiser = new TableSchema.TableColumn(schema);
				colvarAdvertiser.ColumnName = "Advertiser";
				colvarAdvertiser.DataType = DbType.String;
				colvarAdvertiser.MaxLength = 550;
				colvarAdvertiser.AutoIncrement = false;
				colvarAdvertiser.IsNullable = true;
				colvarAdvertiser.IsPrimaryKey = false;
				colvarAdvertiser.IsForeignKey = false;
				colvarAdvertiser.IsReadOnly = false;
				colvarAdvertiser.DefaultSetting = @"";
				colvarAdvertiser.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAdvertiser);
				
				TableSchema.TableColumn colvarAgency = new TableSchema.TableColumn(schema);
				colvarAgency.ColumnName = "Agency";
				colvarAgency.DataType = DbType.String;
				colvarAgency.MaxLength = 550;
				colvarAgency.AutoIncrement = false;
				colvarAgency.IsNullable = true;
				colvarAgency.IsPrimaryKey = false;
				colvarAgency.IsForeignKey = false;
				colvarAgency.IsReadOnly = false;
				colvarAgency.DefaultSetting = @"";
				colvarAgency.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAgency);
				
				TableSchema.TableColumn colvarMediaType1 = new TableSchema.TableColumn(schema);
				colvarMediaType1.ColumnName = "MediaType1";
				colvarMediaType1.DataType = DbType.String;
				colvarMediaType1.MaxLength = 10;
				colvarMediaType1.AutoIncrement = false;
				colvarMediaType1.IsNullable = true;
				colvarMediaType1.IsPrimaryKey = false;
				colvarMediaType1.IsForeignKey = false;
				colvarMediaType1.IsReadOnly = false;
				colvarMediaType1.DefaultSetting = @"";
				colvarMediaType1.ForeignKeyTableName = "";
				schema.Columns.Add(colvarMediaType1);
				
				TableSchema.TableColumn colvarFirstAppearance = new TableSchema.TableColumn(schema);
				colvarFirstAppearance.ColumnName = "FirstAppearance";
				colvarFirstAppearance.DataType = DbType.String;
				colvarFirstAppearance.MaxLength = -1;
				colvarFirstAppearance.AutoIncrement = false;
				colvarFirstAppearance.IsNullable = true;
				colvarFirstAppearance.IsPrimaryKey = false;
				colvarFirstAppearance.IsForeignKey = false;
				colvarFirstAppearance.IsReadOnly = false;
				colvarFirstAppearance.DefaultSetting = @"";
				colvarFirstAppearance.ForeignKeyTableName = "";
				schema.Columns.Add(colvarFirstAppearance);
				
				TableSchema.TableColumn colvarEstimatedHours1 = new TableSchema.TableColumn(schema);
				colvarEstimatedHours1.ColumnName = "EstimatedHours1";
				colvarEstimatedHours1.DataType = DbType.String;
				colvarEstimatedHours1.MaxLength = 10;
				colvarEstimatedHours1.AutoIncrement = false;
				colvarEstimatedHours1.IsNullable = true;
				colvarEstimatedHours1.IsPrimaryKey = false;
				colvarEstimatedHours1.IsForeignKey = false;
				colvarEstimatedHours1.IsReadOnly = false;
				colvarEstimatedHours1.DefaultSetting = @"";
				colvarEstimatedHours1.ForeignKeyTableName = "";
				schema.Columns.Add(colvarEstimatedHours1);
				
				TableSchema.TableColumn colvarProgramName1 = new TableSchema.TableColumn(schema);
				colvarProgramName1.ColumnName = "ProgramName1";
				colvarProgramName1.DataType = DbType.String;
				colvarProgramName1.MaxLength = 550;
				colvarProgramName1.AutoIncrement = false;
				colvarProgramName1.IsNullable = true;
				colvarProgramName1.IsPrimaryKey = false;
				colvarProgramName1.IsForeignKey = false;
				colvarProgramName1.IsReadOnly = false;
				colvarProgramName1.DefaultSetting = @"";
				colvarProgramName1.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProgramName1);
				
				TableSchema.TableColumn colvarMediaType2 = new TableSchema.TableColumn(schema);
				colvarMediaType2.ColumnName = "MediaType2";
				colvarMediaType2.DataType = DbType.String;
				colvarMediaType2.MaxLength = 10;
				colvarMediaType2.AutoIncrement = false;
				colvarMediaType2.IsNullable = true;
				colvarMediaType2.IsPrimaryKey = false;
				colvarMediaType2.IsForeignKey = false;
				colvarMediaType2.IsReadOnly = false;
				colvarMediaType2.DefaultSetting = @"";
				colvarMediaType2.ForeignKeyTableName = "";
				schema.Columns.Add(colvarMediaType2);
				
				TableSchema.TableColumn colvarSecondAppearance = new TableSchema.TableColumn(schema);
				colvarSecondAppearance.ColumnName = "SecondAppearance";
				colvarSecondAppearance.DataType = DbType.String;
				colvarSecondAppearance.MaxLength = -1;
				colvarSecondAppearance.AutoIncrement = false;
				colvarSecondAppearance.IsNullable = true;
				colvarSecondAppearance.IsPrimaryKey = false;
				colvarSecondAppearance.IsForeignKey = false;
				colvarSecondAppearance.IsReadOnly = false;
				colvarSecondAppearance.DefaultSetting = @"";
				colvarSecondAppearance.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSecondAppearance);
				
				TableSchema.TableColumn colvarEstimatedHours2 = new TableSchema.TableColumn(schema);
				colvarEstimatedHours2.ColumnName = "EstimatedHours2";
				colvarEstimatedHours2.DataType = DbType.String;
				colvarEstimatedHours2.MaxLength = 10;
				colvarEstimatedHours2.AutoIncrement = false;
				colvarEstimatedHours2.IsNullable = true;
				colvarEstimatedHours2.IsPrimaryKey = false;
				colvarEstimatedHours2.IsForeignKey = false;
				colvarEstimatedHours2.IsReadOnly = false;
				colvarEstimatedHours2.DefaultSetting = @"";
				colvarEstimatedHours2.ForeignKeyTableName = "";
				schema.Columns.Add(colvarEstimatedHours2);
				
				TableSchema.TableColumn colvarProgramName2 = new TableSchema.TableColumn(schema);
				colvarProgramName2.ColumnName = "ProgramName2";
				colvarProgramName2.DataType = DbType.String;
				colvarProgramName2.MaxLength = 550;
				colvarProgramName2.AutoIncrement = false;
				colvarProgramName2.IsNullable = true;
				colvarProgramName2.IsPrimaryKey = false;
				colvarProgramName2.IsForeignKey = false;
				colvarProgramName2.IsReadOnly = false;
				colvarProgramName2.DefaultSetting = @"";
				colvarProgramName2.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProgramName2);
				
				TableSchema.TableColumn colvarMediaType3 = new TableSchema.TableColumn(schema);
				colvarMediaType3.ColumnName = "MediaType3";
				colvarMediaType3.DataType = DbType.String;
				colvarMediaType3.MaxLength = 10;
				colvarMediaType3.AutoIncrement = false;
				colvarMediaType3.IsNullable = true;
				colvarMediaType3.IsPrimaryKey = false;
				colvarMediaType3.IsForeignKey = false;
				colvarMediaType3.IsReadOnly = false;
				colvarMediaType3.DefaultSetting = @"";
				colvarMediaType3.ForeignKeyTableName = "";
				schema.Columns.Add(colvarMediaType3);
				
				TableSchema.TableColumn colvarThirdAppearance = new TableSchema.TableColumn(schema);
				colvarThirdAppearance.ColumnName = "ThirdAppearance";
				colvarThirdAppearance.DataType = DbType.String;
				colvarThirdAppearance.MaxLength = -1;
				colvarThirdAppearance.AutoIncrement = false;
				colvarThirdAppearance.IsNullable = true;
				colvarThirdAppearance.IsPrimaryKey = false;
				colvarThirdAppearance.IsForeignKey = false;
				colvarThirdAppearance.IsReadOnly = false;
				colvarThirdAppearance.DefaultSetting = @"";
				colvarThirdAppearance.ForeignKeyTableName = "";
				schema.Columns.Add(colvarThirdAppearance);
				
				TableSchema.TableColumn colvarEstimatedHours3 = new TableSchema.TableColumn(schema);
				colvarEstimatedHours3.ColumnName = "EstimatedHours3";
				colvarEstimatedHours3.DataType = DbType.String;
				colvarEstimatedHours3.MaxLength = 10;
				colvarEstimatedHours3.AutoIncrement = false;
				colvarEstimatedHours3.IsNullable = true;
				colvarEstimatedHours3.IsPrimaryKey = false;
				colvarEstimatedHours3.IsForeignKey = false;
				colvarEstimatedHours3.IsReadOnly = false;
				colvarEstimatedHours3.DefaultSetting = @"";
				colvarEstimatedHours3.ForeignKeyTableName = "";
				schema.Columns.Add(colvarEstimatedHours3);
				
				TableSchema.TableColumn colvarProgramName3 = new TableSchema.TableColumn(schema);
				colvarProgramName3.ColumnName = "ProgramName3";
				colvarProgramName3.DataType = DbType.String;
				colvarProgramName3.MaxLength = 550;
				colvarProgramName3.AutoIncrement = false;
				colvarProgramName3.IsNullable = true;
				colvarProgramName3.IsPrimaryKey = false;
				colvarProgramName3.IsForeignKey = false;
				colvarProgramName3.IsReadOnly = false;
				colvarProgramName3.DefaultSetting = @"";
				colvarProgramName3.ForeignKeyTableName = "";
				schema.Columns.Add(colvarProgramName3);
				
				TableSchema.TableColumn colvarComments = new TableSchema.TableColumn(schema);
				colvarComments.ColumnName = "Comments";
				colvarComments.DataType = DbType.String;
				colvarComments.MaxLength = -1;
				colvarComments.AutoIncrement = false;
				colvarComments.IsNullable = true;
				colvarComments.IsPrimaryKey = false;
				colvarComments.IsForeignKey = false;
				colvarComments.IsReadOnly = false;
				colvarComments.DefaultSetting = @"";
				colvarComments.ForeignKeyTableName = "";
				schema.Columns.Add(colvarComments);
				
				TableSchema.TableColumn colvarUploadCommercial = new TableSchema.TableColumn(schema);
				colvarUploadCommercial.ColumnName = "Upload commercial";
				colvarUploadCommercial.DataType = DbType.String;
				colvarUploadCommercial.MaxLength = 550;
				colvarUploadCommercial.AutoIncrement = false;
				colvarUploadCommercial.IsNullable = true;
				colvarUploadCommercial.IsPrimaryKey = false;
				colvarUploadCommercial.IsForeignKey = false;
				colvarUploadCommercial.IsReadOnly = false;
				colvarUploadCommercial.DefaultSetting = @"";
				colvarUploadCommercial.ForeignKeyTableName = "";
				schema.Columns.Add(colvarUploadCommercial);
				
				TableSchema.TableColumn colvarGenerateId = new TableSchema.TableColumn(schema);
				colvarGenerateId.ColumnName = "generateId";
				colvarGenerateId.DataType = DbType.String;
				colvarGenerateId.MaxLength = 50;
				colvarGenerateId.AutoIncrement = false;
				colvarGenerateId.IsNullable = true;
				colvarGenerateId.IsPrimaryKey = false;
				colvarGenerateId.IsForeignKey = false;
				colvarGenerateId.IsReadOnly = false;
				colvarGenerateId.DefaultSetting = @"";
				colvarGenerateId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarGenerateId);
				
				BaseSchema = schema;
				//add this schema to the provider
				//so we can query it later
				DataService.Providers["Adex"].AddSchema("tblHistoricalDataForNewCommercial",schema);
			}
		}
		#endregion
		
		#region Props
		  
		[XmlAttribute("Id")]
		[Bindable(true)]
		public int Id 
		{
			get { return GetColumnValue<int>(Columns.Id); }
			set { SetColumnValue(Columns.Id, value); }
		}
		  
		[XmlAttribute("UserID")]
		[Bindable(true)]
		public int UserID 
		{
			get { return GetColumnValue<int>(Columns.UserID); }
			set { SetColumnValue(Columns.UserID, value); }
		}
		  
		[XmlAttribute("CompanyCode")]
		[Bindable(true)]
		public int? CompanyCode 
		{
			get { return GetColumnValue<int?>(Columns.CompanyCode); }
			set { SetColumnValue(Columns.CompanyCode, value); }
		}
		  
		[XmlAttribute("UserName")]
		[Bindable(true)]
		public string UserName 
		{
			get { return GetColumnValue<string>(Columns.UserName); }
			set { SetColumnValue(Columns.UserName, value); }
		}
		  
		[XmlAttribute("Product")]
		[Bindable(true)]
		public string Product 
		{
			get { return GetColumnValue<string>(Columns.Product); }
			set { SetColumnValue(Columns.Product, value); }
		}
		  
		[XmlAttribute("Version")]
		[Bindable(true)]
		public string Version 
		{
			get { return GetColumnValue<string>(Columns.Version); }
			set { SetColumnValue(Columns.Version, value); }
		}
		  
		[XmlAttribute("LaunchDay")]
		[Bindable(true)]
		public string LaunchDay 
		{
			get { return GetColumnValue<string>(Columns.LaunchDay); }
			set { SetColumnValue(Columns.LaunchDay, value); }
		}
		  
		[XmlAttribute("Duration")]
		[Bindable(true)]
		public string Duration 
		{
			get { return GetColumnValue<string>(Columns.Duration); }
			set { SetColumnValue(Columns.Duration, value); }
		}
		  
		[XmlAttribute("Sector")]
		[Bindable(true)]
		public string Sector 
		{
			get { return GetColumnValue<string>(Columns.Sector); }
			set { SetColumnValue(Columns.Sector, value); }
		}
		  
		[XmlAttribute("SubSector")]
		[Bindable(true)]
		public string SubSector 
		{
			get { return GetColumnValue<string>(Columns.SubSector); }
			set { SetColumnValue(Columns.SubSector, value); }
		}
		  
		[XmlAttribute("Category")]
		[Bindable(true)]
		public string Category 
		{
			get { return GetColumnValue<string>(Columns.Category); }
			set { SetColumnValue(Columns.Category, value); }
		}
		  
		[XmlAttribute("Advertiser")]
		[Bindable(true)]
		public string Advertiser 
		{
			get { return GetColumnValue<string>(Columns.Advertiser); }
			set { SetColumnValue(Columns.Advertiser, value); }
		}
		  
		[XmlAttribute("Agency")]
		[Bindable(true)]
		public string Agency 
		{
			get { return GetColumnValue<string>(Columns.Agency); }
			set { SetColumnValue(Columns.Agency, value); }
		}
		  
		[XmlAttribute("MediaType1")]
		[Bindable(true)]
		public string MediaType1 
		{
			get { return GetColumnValue<string>(Columns.MediaType1); }
			set { SetColumnValue(Columns.MediaType1, value); }
		}
		  
		[XmlAttribute("FirstAppearance")]
		[Bindable(true)]
		public string FirstAppearance 
		{
			get { return GetColumnValue<string>(Columns.FirstAppearance); }
			set { SetColumnValue(Columns.FirstAppearance, value); }
		}
		  
		[XmlAttribute("EstimatedHours1")]
		[Bindable(true)]
		public string EstimatedHours1 
		{
			get { return GetColumnValue<string>(Columns.EstimatedHours1); }
			set { SetColumnValue(Columns.EstimatedHours1, value); }
		}
		  
		[XmlAttribute("ProgramName1")]
		[Bindable(true)]
		public string ProgramName1 
		{
			get { return GetColumnValue<string>(Columns.ProgramName1); }
			set { SetColumnValue(Columns.ProgramName1, value); }
		}
		  
		[XmlAttribute("MediaType2")]
		[Bindable(true)]
		public string MediaType2 
		{
			get { return GetColumnValue<string>(Columns.MediaType2); }
			set { SetColumnValue(Columns.MediaType2, value); }
		}
		  
		[XmlAttribute("SecondAppearance")]
		[Bindable(true)]
		public string SecondAppearance 
		{
			get { return GetColumnValue<string>(Columns.SecondAppearance); }
			set { SetColumnValue(Columns.SecondAppearance, value); }
		}
		  
		[XmlAttribute("EstimatedHours2")]
		[Bindable(true)]
		public string EstimatedHours2 
		{
			get { return GetColumnValue<string>(Columns.EstimatedHours2); }
			set { SetColumnValue(Columns.EstimatedHours2, value); }
		}
		  
		[XmlAttribute("ProgramName2")]
		[Bindable(true)]
		public string ProgramName2 
		{
			get { return GetColumnValue<string>(Columns.ProgramName2); }
			set { SetColumnValue(Columns.ProgramName2, value); }
		}
		  
		[XmlAttribute("MediaType3")]
		[Bindable(true)]
		public string MediaType3 
		{
			get { return GetColumnValue<string>(Columns.MediaType3); }
			set { SetColumnValue(Columns.MediaType3, value); }
		}
		  
		[XmlAttribute("ThirdAppearance")]
		[Bindable(true)]
		public string ThirdAppearance 
		{
			get { return GetColumnValue<string>(Columns.ThirdAppearance); }
			set { SetColumnValue(Columns.ThirdAppearance, value); }
		}
		  
		[XmlAttribute("EstimatedHours3")]
		[Bindable(true)]
		public string EstimatedHours3 
		{
			get { return GetColumnValue<string>(Columns.EstimatedHours3); }
			set { SetColumnValue(Columns.EstimatedHours3, value); }
		}
		  
		[XmlAttribute("ProgramName3")]
		[Bindable(true)]
		public string ProgramName3 
		{
			get { return GetColumnValue<string>(Columns.ProgramName3); }
			set { SetColumnValue(Columns.ProgramName3, value); }
		}
		  
		[XmlAttribute("Comments")]
		[Bindable(true)]
		public string Comments 
		{
			get { return GetColumnValue<string>(Columns.Comments); }
			set { SetColumnValue(Columns.Comments, value); }
		}
		  
		[XmlAttribute("UploadCommercial")]
		[Bindable(true)]
		public string UploadCommercial 
		{
			get { return GetColumnValue<string>(Columns.UploadCommercial); }
			set { SetColumnValue(Columns.UploadCommercial, value); }
		}
		  
		[XmlAttribute("GenerateId")]
		[Bindable(true)]
		public string GenerateId 
		{
			get { return GetColumnValue<string>(Columns.GenerateId); }
			set { SetColumnValue(Columns.GenerateId, value); }
		}
		
		#endregion
		
		
			
		
		//no foreign key tables defined (0)
		
		
		
		//no ManyToMany tables defined (0)
		
        
        
		#region ObjectDataSource support
		
		
		/// <summary>
		/// Inserts a record, can be used with the Object Data Source
		/// </summary>
		public static void Insert(int varUserID,int? varCompanyCode,string varUserName,string varProduct,string varVersion,string varLaunchDay,string varDuration,string varSector,string varSubSector,string varCategory,string varAdvertiser,string varAgency,string varMediaType1,string varFirstAppearance,string varEstimatedHours1,string varProgramName1,string varMediaType2,string varSecondAppearance,string varEstimatedHours2,string varProgramName2,string varMediaType3,string varThirdAppearance,string varEstimatedHours3,string varProgramName3,string varComments,string varUploadCommercial,string varGenerateId)
		{
			TblHistoricalDataForNewCommercial item = new TblHistoricalDataForNewCommercial();
			
			item.UserID = varUserID;
			
			item.CompanyCode = varCompanyCode;
			
			item.UserName = varUserName;
			
			item.Product = varProduct;
			
			item.Version = varVersion;
			
			item.LaunchDay = varLaunchDay;
			
			item.Duration = varDuration;
			
			item.Sector = varSector;
			
			item.SubSector = varSubSector;
			
			item.Category = varCategory;
			
			item.Advertiser = varAdvertiser;
			
			item.Agency = varAgency;
			
			item.MediaType1 = varMediaType1;
			
			item.FirstAppearance = varFirstAppearance;
			
			item.EstimatedHours1 = varEstimatedHours1;
			
			item.ProgramName1 = varProgramName1;
			
			item.MediaType2 = varMediaType2;
			
			item.SecondAppearance = varSecondAppearance;
			
			item.EstimatedHours2 = varEstimatedHours2;
			
			item.ProgramName2 = varProgramName2;
			
			item.MediaType3 = varMediaType3;
			
			item.ThirdAppearance = varThirdAppearance;
			
			item.EstimatedHours3 = varEstimatedHours3;
			
			item.ProgramName3 = varProgramName3;
			
			item.Comments = varComments;
			
			item.UploadCommercial = varUploadCommercial;
			
			item.GenerateId = varGenerateId;
			
		
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		
		/// <summary>
		/// Updates a record, can be used with the Object Data Source
		/// </summary>
		public static void Update(int varId,int varUserID,int? varCompanyCode,string varUserName,string varProduct,string varVersion,string varLaunchDay,string varDuration,string varSector,string varSubSector,string varCategory,string varAdvertiser,string varAgency,string varMediaType1,string varFirstAppearance,string varEstimatedHours1,string varProgramName1,string varMediaType2,string varSecondAppearance,string varEstimatedHours2,string varProgramName2,string varMediaType3,string varThirdAppearance,string varEstimatedHours3,string varProgramName3,string varComments,string varUploadCommercial,string varGenerateId)
		{
			TblHistoricalDataForNewCommercial item = new TblHistoricalDataForNewCommercial();
			
				item.Id = varId;
			
				item.UserID = varUserID;
			
				item.CompanyCode = varCompanyCode;
			
				item.UserName = varUserName;
			
				item.Product = varProduct;
			
				item.Version = varVersion;
			
				item.LaunchDay = varLaunchDay;
			
				item.Duration = varDuration;
			
				item.Sector = varSector;
			
				item.SubSector = varSubSector;
			
				item.Category = varCategory;
			
				item.Advertiser = varAdvertiser;
			
				item.Agency = varAgency;
			
				item.MediaType1 = varMediaType1;
			
				item.FirstAppearance = varFirstAppearance;
			
				item.EstimatedHours1 = varEstimatedHours1;
			
				item.ProgramName1 = varProgramName1;
			
				item.MediaType2 = varMediaType2;
			
				item.SecondAppearance = varSecondAppearance;
			
				item.EstimatedHours2 = varEstimatedHours2;
			
				item.ProgramName2 = varProgramName2;
			
				item.MediaType3 = varMediaType3;
			
				item.ThirdAppearance = varThirdAppearance;
			
				item.EstimatedHours3 = varEstimatedHours3;
			
				item.ProgramName3 = varProgramName3;
			
				item.Comments = varComments;
			
				item.UploadCommercial = varUploadCommercial;
			
				item.GenerateId = varGenerateId;
			
			item.IsNew = false;
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		#endregion
        
        
        
        #region Typed Columns
        
        
        public static TableSchema.TableColumn IdColumn
        {
            get { return Schema.Columns[0]; }
        }
        
        
        
        public static TableSchema.TableColumn UserIDColumn
        {
            get { return Schema.Columns[1]; }
        }
        
        
        
        public static TableSchema.TableColumn CompanyCodeColumn
        {
            get { return Schema.Columns[2]; }
        }
        
        
        
        public static TableSchema.TableColumn UserNameColumn
        {
            get { return Schema.Columns[3]; }
        }
        
        
        
        public static TableSchema.TableColumn ProductColumn
        {
            get { return Schema.Columns[4]; }
        }
        
        
        
        public static TableSchema.TableColumn VersionColumn
        {
            get { return Schema.Columns[5]; }
        }
        
        
        
        public static TableSchema.TableColumn LaunchDayColumn
        {
            get { return Schema.Columns[6]; }
        }
        
        
        
        public static TableSchema.TableColumn DurationColumn
        {
            get { return Schema.Columns[7]; }
        }
        
        
        
        public static TableSchema.TableColumn SectorColumn
        {
            get { return Schema.Columns[8]; }
        }
        
        
        
        public static TableSchema.TableColumn SubSectorColumn
        {
            get { return Schema.Columns[9]; }
        }
        
        
        
        public static TableSchema.TableColumn CategoryColumn
        {
            get { return Schema.Columns[10]; }
        }
        
        
        
        public static TableSchema.TableColumn AdvertiserColumn
        {
            get { return Schema.Columns[11]; }
        }
        
        
        
        public static TableSchema.TableColumn AgencyColumn
        {
            get { return Schema.Columns[12]; }
        }
        
        
        
        public static TableSchema.TableColumn MediaType1Column
        {
            get { return Schema.Columns[13]; }
        }
        
        
        
        public static TableSchema.TableColumn FirstAppearanceColumn
        {
            get { return Schema.Columns[14]; }
        }
        
        
        
        public static TableSchema.TableColumn EstimatedHours1Column
        {
            get { return Schema.Columns[15]; }
        }
        
        
        
        public static TableSchema.TableColumn ProgramName1Column
        {
            get { return Schema.Columns[16]; }
        }
        
        
        
        public static TableSchema.TableColumn MediaType2Column
        {
            get { return Schema.Columns[17]; }
        }
        
        
        
        public static TableSchema.TableColumn SecondAppearanceColumn
        {
            get { return Schema.Columns[18]; }
        }
        
        
        
        public static TableSchema.TableColumn EstimatedHours2Column
        {
            get { return Schema.Columns[19]; }
        }
        
        
        
        public static TableSchema.TableColumn ProgramName2Column
        {
            get { return Schema.Columns[20]; }
        }
        
        
        
        public static TableSchema.TableColumn MediaType3Column
        {
            get { return Schema.Columns[21]; }
        }
        
        
        
        public static TableSchema.TableColumn ThirdAppearanceColumn
        {
            get { return Schema.Columns[22]; }
        }
        
        
        
        public static TableSchema.TableColumn EstimatedHours3Column
        {
            get { return Schema.Columns[23]; }
        }
        
        
        
        public static TableSchema.TableColumn ProgramName3Column
        {
            get { return Schema.Columns[24]; }
        }
        
        
        
        public static TableSchema.TableColumn CommentsColumn
        {
            get { return Schema.Columns[25]; }
        }
        
        
        
        public static TableSchema.TableColumn UploadCommercialColumn
        {
            get { return Schema.Columns[26]; }
        }
        
        
        
        public static TableSchema.TableColumn GenerateIdColumn
        {
            get { return Schema.Columns[27]; }
        }
        
        
        
        #endregion
		#region Columns Struct
		public struct Columns
		{
			 public static string Id = @"ID";
			 public static string UserID = @"UserID";
			 public static string CompanyCode = @"CompanyCode";
			 public static string UserName = @"UserName";
			 public static string Product = @"Product";
			 public static string Version = @"Version";
			 public static string LaunchDay = @"LaunchDay";
			 public static string Duration = @"Duration";
			 public static string Sector = @"Sector";
			 public static string SubSector = @"SubSector";
			 public static string Category = @"Category";
			 public static string Advertiser = @"Advertiser";
			 public static string Agency = @"Agency";
			 public static string MediaType1 = @"MediaType1";
			 public static string FirstAppearance = @"FirstAppearance";
			 public static string EstimatedHours1 = @"EstimatedHours1";
			 public static string ProgramName1 = @"ProgramName1";
			 public static string MediaType2 = @"MediaType2";
			 public static string SecondAppearance = @"SecondAppearance";
			 public static string EstimatedHours2 = @"EstimatedHours2";
			 public static string ProgramName2 = @"ProgramName2";
			 public static string MediaType3 = @"MediaType3";
			 public static string ThirdAppearance = @"ThirdAppearance";
			 public static string EstimatedHours3 = @"EstimatedHours3";
			 public static string ProgramName3 = @"ProgramName3";
			 public static string Comments = @"Comments";
			 public static string UploadCommercial = @"Upload commercial";
			 public static string GenerateId = @"generateId";
						
		}
		#endregion
		
		#region Update PK Collections
		
        #endregion
    
        #region Deep Save
		
        #endregion
	}
}
